package com.bjsxt.thread;

public class RunnableTest implements Runnable{  //RunnableTest这个类不是线程，没有继承Thread类, 就是普通类
    public RunnableTest(){
        System.out.println(Thread.currentThread().getName());
    }
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"线程开始");
        for (int i=0;i<200;i++){
            System.out.println(Thread.currentThread().getName()+" "+i);
        }
        System.out.println(Thread.currentThread().getName()+"线程结束");
    }

    public static void main(String[] args) {
        System.out.println("主线程开始");
        RunnableTest test = new RunnableTest();
        Thread t = new Thread(test); //把普通类包装为线程
        t.start();

        Thread t2 = new Thread(new RunnableTest());
        t2.start();

        System.out.println("主线程结束");

    }
}
